unit uRelatorioExtrasAtraso;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxStyles, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinOffice2007Black,
  dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
  dxSkinOffice2007Silver, 
  dxSkinscxPCPainter, cxCustomData, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, StdCtrls, Buttons, cxGridLevel,
  cxClasses, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxGrid, dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd,
  dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns, dxPSEdgePatterns,
  dxPSPDFExportCore, dxPSPDFExport, cxDrawTextUtils, dxPSPrVwStd, dxPSPrVwAdv,
  dxPSPrVwRibbon, dxPScxPageControlProducer, dxPScxEditorProducers,
  dxPScxExtEditorProducers, dxSkinsdxBarPainter, dxSkinsdxRibbonPainter,
  dxPgsDlg, dxPrnDlg, dxPSCore, dxPScxGrid6Lnk, dxPSDBBasedXplorer,
  dxBarSkinnedCustForm, dxPScxCommon, ZAbstractRODataset, ZAbstractDataset,
  ZAbstractTable, ZDataset, dxSkinOffice2010Black, dxSkinOffice2010Blue,
  dxSkinOffice2010Silver, uReportDatamodule, uDataModule;

type
  TFRelatorioExtrasAtraso = class(TForm)
    btn_Imprimir: TBitBtn;
    dxPrinter1: TdxComponentPrinter;
    dxEngController: TdxPSEngineController;
    cxgrdExtrasAtraso: TcxGrid;
    gdExtrasAtraso: TcxGridDBTableView;
    cxgrdlvlExtrasAtraso: TcxGridLevel;
    btn_VizualizarImpressao: TBitBtn;
    dxgrdrprtlnkPrinter1Link1: TdxGridReportLink;
    lbl37: TLabel;
    cxStyleRepository1: TcxStyleRepository;
    cxStyle1: TcxStyle;
    cxStyle2: TcxStyle;
    procedure btn_ImprimirClick(Sender: TObject);
    procedure btn_VizualizarImpressaoClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRelatorioExtrasAtraso: TFRelatorioExtrasAtraso;

implementation

{$R *.dfm}

procedure TFRelatorioExtrasAtraso.btn_ImprimirClick(Sender: TObject);
begin
  dxPrinter1.Print(True,nil);
end;

procedure TFRelatorioExtrasAtraso.btn_VizualizarImpressaoClick(Sender: TObject);
begin
  dxPrinter1.preview(True, nil);
end;


procedure TFRelatorioExtrasAtraso.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  dmreport.Free;
end;

procedure TFRelatorioExtrasAtraso.FormCreate(Sender: TObject);
begin
  gdExtrasAtraso.DataController.BeginUpdate;
  dmreport := Tdmreport.Create(Application);
  dmreport.loadExtrasEmAtraso;
  gdExtrasAtraso.DataController.CreateAllItems();
  gdExtrasAtraso.DataController.EndUpdate;
  gdExtrasAtraso.ApplyBestFit();
end;

end.
